import Vue from "vue"
import VueRouter from "vue-router"
Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((error) => error)
}
const routes = [
  {
    path: "/",
    component: () => import("@/layout/index.vue"),
    children: [
      {
        path: "",
        name: "chat",
        component: () => import("@/views/indexPage.vue")
      },
      {
        path: "/chat",
        name: "mainChat",
        component: () => import("@/components/main/chat.vue")
      }
    ]
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/Login.vue")
  },
  {
    path: "/register",
    name: "register",
    component: () => import("@/views/Register.vue")
  },
  {
    path: "/g6",
    name: "g6",
    component: () => import("@/views/g6Page.vue")
  }
]

const router = new VueRouter({
  routes
})
export default router
